import { createStore, applyMiddleware } from 'redux'
import createSagaMiddleware from 'redux-saga'
import { Map } from 'immutable'

import reducer from './reducer'
import sagas from './sagas'


const initialState = Map({})
const sagaMiddleware = createSagaMiddleware()

const store = createStore(
    reducer,
    initialState,
    applyMiddleware(sagaMiddleware)
)

sagas.forEach(saga => sagaMiddleware.run(saga))

export default store